<template>
  <div class="add-wrap">
    <div class="body">
      <div class="project">
        <el-form
          :model="basicForm"
          label-position="top"
          :rules="basicRules"
          ref="basicFormRef"
        >
          <!-- 企业信息 -->
          <div class="project-part">
            <div
              class="project-part-title project-part-title1"
            >
              企业信息
            </div>
            <div class="project-part-content">
              <el-row :gutter="24">
                <el-col :sm="24" :md="12" :lg="8" :xl="6">
                  <el-form-item
                    label="企业名称"
                    prop="companyName"
                  >
                    <el-input
                      v-model="basicForm.companyName"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :sm="24" :md="12" :lg="8" :xl="6">
                  <el-form-item
                    label="统一社会信用代码"
                    prop="code"
                  >
                    <el-input
                      v-model="basicForm.code"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :sm="24" :md="12" :lg="8" :xl="6">
                  <el-form-item
                    label="产业类型"
                    prop="companyType"
                  >
                    <el-input
                      v-model="basicForm.companyType"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :sm="24" :md="12" :lg="8" :xl="6">
                  <el-form-item
                    label="成立时间"
                    prop="completeTime"
                  >
                    <el-date-picker
                      v-model="basicForm.completeTime"
                      type="date"
                      value-format="yyyy-MM-dd"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :sm="24" :md="12" :lg="8" :xl="6">
                  <el-form-item
                    label="注册资本"
                    prop="registerBond"
                  >
                    <el-input
                      v-model="basicForm.registerBond"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :sm="24" :md="12" :lg="8" :xl="6">
                  <el-form-item
                    label="注册地址"
                    prop="registerAddress"
                  >
                    <el-input
                      v-model="basicForm.registerAddress"
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </div>
          <!-- 政策筛选 -->
          <div class="project-part">
            <div
              class="project-part-title project-part-title1"
            >
              政策信息
            </div>
            <div class="project-part-content">
              <el-row :gutter="24">
                <el-col :sm="24" :md="24" :lg="24" :xl="24">
                  <el-form-item
                    label="您对以下哪些类型的政策感兴趣"
                    prop="name"
                  >
                    <el-checkbox-group
                      v-model="basicForm.policyType"
                    >
                      <el-checkbox
                        v-for="item in policyTypeOptions"
                        :label="item.dictValue"
                        :key="item.dictValue"
                        >{{ item.dictText }}</el-checkbox
                      >
                    </el-checkbox-group>
                  </el-form-item>
                </el-col>
                <el-col :sm="24" :md="24" :lg="24" :xl="24">
                  <el-form-item
                    label="您对以下哪类扶持政策感兴趣"
                    prop="name"
                  >
                    <el-checkbox-group
                      v-model="basicForm.supportPolicyType"
                    >
                      <el-checkbox
                        v-for="item in supportPolicyTypeOptions"
                        :label="item.dictValue"
                        :key="item.dictValue"
                        >{{ item.dictText }}</el-checkbox
                      >
                    </el-checkbox-group>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </div>
        </el-form>
      </div>
    </div>
  </div>
</template>
<script>
import { getDictOptions } from '@/utils/dict'
export default {
  data() {
    return {
      basicForm: {
        policyType: [],
        supportPolicyType: []
      },
      basicRules: {
        companyName: [
          {
            required: true,
            message: '请输入企业名称',
            trigger: 'blur'
          }
        ]
      },
      policyTypeOptions: [],
      supportPolicyTypeOptions: []
    }
  },
  mounted() {
    this.initOptions()
  },
  methods: {
    async initOptions() {
      const data = await getDictOptions(
        'zhjs_policy_zclx,zhjs_policy_fc_zclx'
      )
      this.policyTypeOptions = data.filter(
        (i) => i.dictCode === 'zhjs_policy_zclx'
      )[0].resourceDictItems
      this.supportPolicyTypeOptions = data.filter(
        (i) => i.dictCode === 'zhjs_policy_fc_zclx'
      )[0].resourceDictItems
    },
    saveInfo() {
      this.$emit('search', this.basicForm)
    }
  }
}
</script>
<style lang="scss" scoped>
@import '~@/assets/css/form.scss';
.add-wrap {
}
</style>
